const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");

module.exports = {
  entry: {
    list: "./src/list/index.js",
    detail: "./src/detail/index.js",
  },
  output: {
    filename: "scripts/[name].[chunkhash:5].js",
  },
  stats: {
    modules: false,
    colors: true,
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
  },
  module: {},
  plugins: [
    new CopyWebpackPlugin([{ from: "./public", to: "./" }]),
    new HtmlWebpackPlugin({
      template: "./public/list.html",
      filename: "list.html",
      chunks: ["list"],
    }),
    new HtmlWebpackPlugin({
      template: "./public/detail.html",
      filename: "detail.html",
      chunks: ["detail"],
    }),
  ],
};
